<div class="ibox-content">
<form class="form-horizontal" id="f_add" action="{:U('Cti/ip2extenEdit_f')}" method="post" >
                               
<div class="col-sm-12" style="margin-top:10px;">
                                
                                <div class="form-group"> <label >&nbsp;&nbsp;&nbsp;&nbsp;分机号：</label>
                                        <input type="number" name="exten"  placeholder="填写分机号" maxlength="8" onkeyup='this.value=this.value.replace(/\D/gi,"")' class=""  value="{$exten}" />
                                </div>
                                <div class="form-group"> <label >&nbsp;&nbsp;&nbsp;&nbsp;IP地址：</label>
                                        <input type="text" name="ip"  placeholder="填写IP地址" class=""  value="{$ip}" />
                                </div>
                                 <div class="form-group"> <label > &nbsp;&nbsp;CTI编号：</label>
                                        <input type="number" name="cti_id"  placeholder="填写CTI编号" maxlength="25" class=""  value="{$cti_id}" />
                                </div>
                                 <div class="form-group"> <label >WEB编号：</label>
                                        <input type="number" name="web_id"  placeholder="填写WEB编号" maxlength="25" class=""  value="{$web_id}" />
                                </div>
                                <div class="form-group" style="text-align:center">
                                        <input class="btn btn-primary" id="btn_save"  type="submit" name="submit" value="确定"/> &nbsp; <input type="hidden" name='ip2extenid' value="{$id}"/>
                                        <input class="btn" onclick="javascript:layer.closeAll();"  type="button" value="{:L('CANCEL')}"/>
                                </div>
</div>
</form>
</div>

 <script>

$(function(){

    $('.i-checks').iCheck({
        checkboxClass: 'icheckbox_square-green',
        radioClass: 'iradio_square-green',
    });
     //请求一个url，返回结果并显示，可以设置是否弹出确问询
        function ajax_do(url,param,show_confirm ,confirm_title,confirm_text){
            
          if(show_confirm){
            swal({
                title: confirm_title,
                text: confirm_text,
                type: "info",
                confirmButtonText:'确定',
                cancelButtonText:'取消',
                showCancelButton: true,
                closeOnConfirm: false,
                showLoaderOnConfirm: true, 
              }, 
              function(){
                $.post(url+'&t=' + Math.random(1000),param, function(data){
                  swal.close();
                  parent.layer.open({
                    type: 1,
                    title: false,
                    closeBtn: false,
                    shadeClose:true, //点击遮罩层 关闭
                    content: data,
                    end: function(index){
                        // $(".content_wrap").load('index.php?m=user&a=actionlist');
                        reloadPage();
                    }
                  });
                  
                }, 'html');
              
              });
          }else{
            $.post(url+'&t=' + Math.random(1000),param, function(data){
              parent.layer.open({
                type: 1,
                title: false,
                closeBtn: false,
                shadeClose:true, //点击遮罩层 关闭
                content: data,
                end: function(index){
                     window.location.reload();
                    // $(".content_wrap").load('index.php?m=user&a=actionlist');
                    //reloadPage();
                }
              });
              
            }, 'html');

          }

            
          
        }  

$("#btn_save").click(function () {        
       var url = '{:U("cti/ip2extenEdit_f")}';
    ajax_do(url,$("#f_add").serialize());   
    return false;
        
    });
    


});



</script>
